import { Button } from 'antd-mobile';
import 'antd-mobile/dist/antd-mobile.css';
import { BrowserRouter as Router, Route, Link, Redirect } from 'react-router-dom'

// 3.0 导入相关组件
import Home from './pages/Home'
import CityList from './pages/CityList'
import HouseInfo from './pages/HouseInfo'

function App() {
  return (
    <div className="App">
      {/* 将BrowserRouter组价作为整个项目的跟组件 */}
      <Router>
        {/* <Button type="primary" >Home页面</Button>
        <Button type="primary">CityList页面</Button> */}
        {/* <Link to="/home">Home页面</Link><br />
        <Link to="/citylist">城市选择页面</Link><br /> */}

        {/* 2.0 注册首页和CityList页面的路由规则 */}
        <Route path="/" exact render={() => <Redirect to="/home/index"></Redirect>}></Route>
        <Route path="/home" component={Home}></Route>
        <Route path="/citylist" component={CityList}></Route>
        {/* 给房屋详情页面注册带参数的路由规则 */}
        <Route path="/info/:id" component={HouseInfo}></Route>
      </Router>
    </div >
  );
}

export default App;
